<!--页面组件-->




<template>
  <!-- processingModal1 -->
  <div class="processingModal">
    <!-- <Modal
      v-model="showCreateTaskModal"
      draggable
      scrollable
      title="任务创建"
      :width="1140"
      :styles="{ top: '60px' }"
      class="processingModal"
    > -->
    <!--名称和关闭-->
    <!-- <p slot="header" class="modalHeader">任务创建</p> -->
    <!-- <p style="margin-left: 24px">任务创建</p> -->
    <!-- <CButtonClose slot="close" @click="closeModalOfTaskCreate" style="visibility:hidden"/> -->
    <!--主体-->
    <CRow>
      <!--流程选择和配置-->
      <CCard class="leftCard" border-color="white" style="width: 60%">
        <div class="cardBody">
          <!--主题算法选择配置-->
          <header>
            <!--名称和优先级-->
            <CRow>
              <CCol md="7">
                <CInput
                  label="任务名称"
                  style="width: 385px"
                  horizontal
                  v-model="taskName"
                  :title="taskName"
                  maxlength="100"
                />
              </CCol>
              <CCol md="5">
                <!-- <CSelect
                                    label="优先级"
                                    style="width:210px"
                                    horizontal
                                    :options="options"
                                    :value.sync="priorityLevel"
                                    />-->
                <div>
                  <div class="levelDiv" v-if="isPriorShow">优先级</div>
                  <div class="inputRadioDiv1" v-if="isPriorShow">
                    <CInputRadio
                      v-for="(item, index) in options"
                      :key="index"
                      type="radio"
                      :label="item.label"
                      :checked="item.isCheck"
                      @change="changeInputLevel(index)"
                      style="margin: 0 10px"
                    />
                  </div>
                </div>
              </CCol>
            </CRow>
            <!-- 预约时间 新增-->
            <CRow>
              <CCol md="7">
                <span style="margin-right: 38px">预约时间</span>
                <el-date-picker
                  v-model="appointmentTime"
                  type="datetime"
                  maxlength="100"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  placeholder="请选择预约时间"
                  :picker-options="pickerOptions"
                >
                </el-date-picker>
                <div style="height: 17px"></div>
              </CCol>
            </CRow>
            <!--产品类型-->
            <CRow v-show="productionTypeRow" class="filterRadioRow">
              <div class="inputRadioDiv3">
                <span style="margin-right: 38px">产品类型</span>
                <CInputRadio
                  v-for="(item, index) in productionType"
                  :key="index"
                  type="radio"
                  :label="item.label"
                  :checked="item.isCheck"
                  @change="changeInputProductionType(index)"
                  style="margin-left: 10px; margin-right: 10px"
                />
              </div>
              <!-- <div v-show="isRegion" style="margin-left: 66px; margin-top: -6px; width: 31.6%;">
                                  <span style="float:left;margin-top: 6px;">区域</span>
                                  <Cascader
                                    :data="regionCascader"
                                    change-on-select
                                    filterable
                                    v-model="algSelect"
                                    class="regionCas"
                                    :load-data="loadRegionData"
                                    @on-change="regionChangeEvent"
                                  ></Cascader>
                                </div>-->
            </CRow>

            <!--卫星传感器-->
            <CRow v-show="sensorRow">
              <CSelect
                label="卫星/传感器"
                class="processFileterDiv"
                horizontal
                :options="sensorOption"
                :value.sync="sensorOptionValue"
                @change="changeSensorType(index)"
                style="margin-left: 10px"
              />
            </CRow>
            <!--算法类型-->
            <CRow v-show="algoModelRow">
              <CSelect
                label="算法模型"
                class="processFileterDiv"
                horizontal
                :options="algoTypeOption"
                :value.sync="algoTypeOptionValue"
                @change="changeInputAlgoType(index)"
                style="margin-left: 10px"
              />
            </CRow>

            <!--合成方式-->
            <CRow v-show="timeRow">
              <!-- <div style="margin-left:16px">合成方式</div> -->
              <!-- <div class="inputRadioDiv4">
                                  <CInputRadio
                                    v-for="(item,index) in mixType"
                                    :key="index"
                                    type="radio"
                                    :label="item.label"
                                    :checked="item.isCheck"
                                    :value.sync="mixTypeValue"
                                    @change="changeInputMixType(index)"
                                    style="margin-left:10px;margin-right:10px"
                                  />
                                </div>-->
              <CSelect
                label="合成方式"
                class="processFileterDiv"
                horizontal
                :options="mixType"
                :value.sync="mixTypeValue"
                style="margin-left: 10px"
              />
            </CRow>
            <!--时间尺度-->
            <CRow v-show="timeRow" class="filterRadioRow">
              <div class="inputRadioDiv3">
                <span style="margin-right: 38px">时间尺度</span>
                <CInputRadio
                  v-for="(item, index) in timeList"
                  :key="index"
                  type="radio"
                  :label="item.label"
                  :checked="item.isCheck"
                  @change="changeInputTimeOption(index)"
                  style="margin-left: 10px; margin-right: 10px"
                />
                <!-- <div
                                      v-show="isRegion"
                                      style="margin-left: 206px; margin-top: -6px; width: 31.6%;"
                                    >
                                      <span style="float:left;margin-top: 6px;">区域</span>
                                      <Cascader
                                        :title="regionTitle"
                                        :data="regionCascader"
                                        change-on-select
                                        filterable
                                        class="regionCas"
                                        :load-data="loadRegionData"
                                        @on-change="regionChangeEvent"
                                      ></Cascader>
                                    </div>-->
                <!-- style="margin-left:138px" -->
                <div>
                  <!-- <label class="filterLabel">时间</label> -->
                  <DatePickers
                    :type="timeType"
                    :placeholder="timePlaceholder"
                    :format="timeFormat"
                    class="datePick"
                    transfer
                    show-week-numbers
                    @on-change="onTimeChange"
                    :value="currentTime"
                    :editable="false"
                  ></DatePickers>
                </div>
              </div>
              <!-- <div style="margin-left:122px;margin-top:2px" class="form-group">
                                  <label>时间</label>
                                  <DatePickers
                                    :type="timeType"
                                    :placeholder="timePlaceholder"
                                    :format="timeFormat"
                                    class="datePick"
                                    transfer
                                    show-week-numbers
                                    @on-change="onTimeChange"
                                    :value="currentTime"
                                    :editable="false"
                                  ></DatePickers>
                                </div>-->
            </CRow>
            <!--流程选择-->
            <CRow v-show="productionLineRow">
              <div class="form-row form-group" style="margin-left: 10px">
                <CCol sm="1.5">
                  <span>流程选择</span>
                </CCol>
                <div class="inputRadioDiv">
                  <CInputRadio
                    v-for="(item, index) in listproductLine"
                    :key="index"
                    type="radio"
                    :label="item.workflowName"
                    :value="item.workflowName"
                    :checked="item.isCheck"
                    @change="changeInput(index)"
                    @click="searchProductLine(item, index)"
                    class="inputRadio"
                  />
                </div>
              </div>
            </CRow>
            <!-- 勿删  新增区域选择功能  自定义功能需要确认 待开启-->
            <!-- <CRow v-show="isRegion">
                               <RegionSelectionComponent
                                @regionValue="getSelectRegionValue"
                                @fileSelectModal="browserFile"
                              ></RegionSelectionComponent>
                                   </CRow
                            >
              <!--区域范围-->
            <CRow v-show="isRegion">
              <div class="inputRadioDiv3">
                <span style="margin-right: 38px">区域范围</span>
                <div>
                  <CInputRadio
                    v-for="(item, index) in regionType"
                    :key="index"
                    type="radio"
                    :label="item.label"
                    :checked="item.isCheck"
                    @change="changeInputRegionOption(index)"
                    style="margin-left: 10px; margin-right: 10px"
                  />
                </div>
                <div>
                  <Cascader
                    :title="regionTitle"
                    :data="regionCascader"
                    change-on-select
                    filterable
                    class="regionCas"
                    :load-data="loadRegionData"
                    @on-change="regionChangeEvent"
                  ></Cascader>
                </div>
              </div>
            </CRow>
          </header>
          <main>
            <div class="position-relative table-responsive1">
              <table class="table">
                <!-- table-hover -->
                <!-- table-bordered -->
                <!-- <thead>
                                            <th style="vertical-align: center">
                                              <div style="width:50%; text-align:center; margin:0 auto">
                                                <div style=" position:absolute">参数名称</div>
                                                <div style="float:right">参数值</div>
                                              </div>
                                            </th>
                                    </thead>-->
                <tbody>
                  <!-- 基本参数选项设置    判断参数 showGlobalParameter -->
                  <tr v-show="showGlobalParameter">
                    <td>
                      <!--基本参数的头部和下拉更多-->
                      <div class="tbHeader">
                        <span style="float: left">基本参数：</span>
                        <CButton
                          class="hoverstyle imgBtn"
                          id="globalParamId"
                          :title="'显示更多参数'"
                          variant="outline"
                          color="info"
                          :flag="'hidden'"
                          @click="displayInputDtParamBtn('globalBtn')"
                        >
                          <img class="jia" :src="tdRightImg('plus')" alt />
                        </CButton>
                      </div>
                      <CDataTable
                        :key="Math.random()"
                        :items="globalItemsDisplayItems"
                        :fields="fields"
                        class="paramTable"
                        :header="haveHeader"
                        border
                        hover
                      >
                        <template #label="{ item }">
                          <td
                            v-if="!item.selectItem"
                            :title="`${item.type.name}${
                              item.type.plural === true ||
                              item.type.plural === 'true'
                                ? '数组'
                                : ''
                            }`"
                          >
                            <span
                              v-if="item.mandatory != null && item.mandatory"
                              style="color: red"
                              >*</span
                            >
                            {{ item.label }}
                          </td>
                        </template>
                        <template #value="{ item }" style="width: 60%">
                          <div v-if="!item.selectItem">
                            <!--下拉-->
                            <CSelect
                              v-if="item.type.name.toLowerCase() === 'select'"
                              horizontal
                              :options="item.constraint"
                              :value.sync="item.default"
                              class="inputSelectTd"
                              placeholder="请选择"
                              @update:value="
                                selectChange(
                                  $event,
                                  item,
                                  globalItemsDisplayItems
                                )
                              "
                            ></CSelect>
                            <!--单选-->
                            <CSelect
                              v-else-if="
                                item.type.name.toLowerCase() === 'boolean'
                              "
                              horizontal
                              :options="[
                                { label: '请选择', value: '' },
                                { label: '是', value: true },
                                { label: '否', value: false },
                              ]"
                              :value.sync="item.default"
                              class="inputSelectTd"
                            ></CSelect>
                            <!--判断 dir 进行文件选择-->
                            <div
                              v-else-if="item.type.name.toLowerCase() === 'dir'"
                            >
                              <template>
                                <CInput
                                  v-model="item['default']"
                                  clearable
                                  autocomplete="off"
                                  class="inputTd"
                                  :title="
                                    item.default
                                      ? item.default
                                      : '双击文本框输入'
                                  "
                                  :placeholder="`${item.desc}`"
                                  @dblclick="onFocus(item)"
                                />
                                <CButton
                                  color="info"
                                  size="sm"
                                  @click="browserFile(item)"
                                  class="btnBrowser system-btn-style"
                                  >...
                                </CButton>
                              </template>
                            </div>
                            <!--判断 file 进行文件选择-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'file'
                              "
                            >
                              <template horizontal>
                                <CInput
                                  v-model="item.default"
                                  clearable
                                  autocomplete="off"
                                  class="inputTd"
                                  :title="
                                    item.default
                                      ? item.default
                                      : '双击文本框输入'
                                  "
                                  :placeholder="`${item.desc}`"
                                  @dblclick="onFocus(item)"
                                />
                                <CButton
                                  color="info"
                                  size="sm"
                                  @click="browserFile(item)"
                                  class="btnBrowser system-btn-style"
                                  >...
                                </CButton>
                              </template>
                            </div>
                            <!--判断 spatialref 进行文件选择-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'spatialref'
                              "
                            >
                              <template>
                                <CInput
                                  v-model="item.default"
                                  clearable
                                  autocomplete="off"
                                  class="inputTd"
                                  :title="item.default"
                                  :placeholder="`${item.desc}`"
                                />
                                <CButton
                                  color="info"
                                  size="sm"
                                  @click="browserRef(item)"
                                  class="btnBrowser system-btn-style"
                                  >...
                                </CButton>
                              </template>
                            </div>
                            <!--判断float 输入框并进行值的校验-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'float' ||
                                item.type.name.toLowerCase() === 'double' ||
                                item.type.name.toLowerCase() === 'int'
                              "
                              class="inputTd"
                            >
                              <Form
                                :model="item"
                                :rules="ruleCustom"
                                ref="item"
                              >
                                <FormItem
                                  prop="default"
                                  :rules="[
                                    {
                                      validator: (rule, value, callback) => {
                                        let data = item;
                                        if (!data.hasOwnProperty('constraint'))
                                          callback();
                                        let min = data.constraint.min;
                                        let max = data.constraint.max;
                                        let num = parseFloat(value);
                                        var reg = /-?[0-9]*\.?[0-9]+/;
                                        if (
                                          new RegExp(reg).test(value) == false
                                        ) {
                                          if (max == undefined) {
                                            callback(
                                              '请输入' + min + '以上的值'
                                            );
                                          } else
                                            callback(
                                              '请输入' +
                                                min +
                                                '-' +
                                                max +
                                                '之间的值'
                                            );
                                        } else {
                                          if (max == undefined) {
                                            if (num >= min) callback();
                                            else
                                              callback(
                                                '请输入' + min + '以上的值'
                                              );
                                          } else {
                                            if (num >= min && num <= max)
                                              callback();
                                            else {
                                              if (max == undefined)
                                                callback(
                                                  '请输入' + min + '以上的值'
                                                );
                                              else
                                                callback(
                                                  '请输入' +
                                                    min +
                                                    '-' +
                                                    max +
                                                    '之间的值'
                                                );
                                            }
                                          }
                                        }
                                      },
                                    },
                                  ]"
                                >
                                  <Input
                                    v-model="item.default"
                                    clearable
                                    autocomplete="off"
                                    placeholder="请输入数字"
                                    number
                                  />
                                </FormItem>
                              </Form>
                            </div>
                            <!--  dem_select  select可以下拉或者 file-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'dem_select' ||
                                item.type.name.toLowerCase() ===
                                  'base_index_select' ||
                                item.type.name.toLowerCase() === 'ref_select'
                              "
                            >
                              <template>
                                <i-select
                                  v-show="item.constraint.demCodeShow"
                                  class="inputTd"
                                  :id="`${item.name}`"
                                  :ref="`${item.name}`"
                                  v-model="item.default"
                                  filterable
                                  transfer
                                >
                                  <i-option
                                    v-for="item1 in item.constraint.values"
                                    :value="item1.value"
                                    :key="item1.value"
                                    >{{ item1.label }}
                                  </i-option>
                                </i-select>
                                <!-- <CButton
                                                                color="info"
                                                                size="sm"
                                                                @click="switchDemType(item)"
                                                                class="btnBrowser"
                                                                >d</CButton
                                                              > -->
                              </template>

                              <template>
                                <div v-show="!item.constraint.demCodeShow">
                                  <CInput
                                    v-model="item['default']"
                                    clearable
                                    autocomplete="off"
                                    class="inputTd"
                                    :title="
                                      item.default
                                        ? item.default
                                        : '双击文本框输入'
                                    "
                                    :placeholder="`${item.desc}`"
                                    @dblclick="onFocus(item)"
                                  />
                                  <CButton
                                    color="info"
                                    size="sm"
                                    @click="browserFile(item)"
                                    class="btnBrowser system-btn-style"
                                    >...
                                  </CButton>
                                </div>
                              </template>
                            </div>

                            <!--input输入框-->
                            <Input
                              v-else
                              v-model="item.default"
                              clearable
                              class="inputTd"
                              :placeholder="`${item.desc}`"
                            />
                          </div>
                        </template>
                      </CDataTable>
                    </td>
                  </tr>

                  <!--动态主题参数-->
                  <tr
                    v-for="(item2, index) in inputDisplayParamItems"
                    :key="item2"
                    v-show="showInputParameter"
                  >
                    <td>
                      <!--头部信息和更多下拉选择-->
                      <div class="tbHeader">
                        <span style="float: left">{{ item2.groupName }}</span>
                        <CButton
                          :id="`${item2.groupName}_${index}`"
                          class="hoverstyle imgBtn"
                          :title="'显示更多参数'"
                          variant="outline"
                          color="info"
                          :flag="'display'"
                          @click="displayInputDtParamBtn(item2, index)"
                        >
                          <img class="jia" :src="tdRightImg('plus')" alt />
                        </CButton>
                      </div>

                      <CDataTable
                        :key="Math.random()"
                        :items="item2"
                        :fields="fields"
                        :class="
                          `${item2.length}` < 1
                            ? 'paramTable paramTable1 '
                            : 'paramTable'
                        "
                        :header="haveHeader"
                        border
                        hover
                      >
                        <template #label="{ item }">
                          <td
                            v-if="!item.selectItem"
                            :title="`${item.type.name}${
                              item.type.plural === true ||
                              item.type.plural === 'true'
                                ? '数组'
                                : ''
                            }`"
                          >
                            <!-- 必填项前边加 *  -->
                            <span
                              v-if="item.mandatory != null && item.mandatory"
                              style="color: red"
                              >*</span
                            >
                            {{ item.label }}
                          </td>
                        </template>
                        <template #value="{ item }" style="width: 60%">
                          <div v-if="!item.selectItem">
                            <!--下拉-->
                            <CSelect
                              v-if="item.type.name.toLowerCase() === 'select'"
                              horizontal
                              :options="item.constraint"
                              :value.sync="item.default"
                              class="inputSelectTd"
                              placeholder="请选择"
                              @update:value="selectChange($event, item, item2)"
                            ></CSelect>
                            <!--单选-->
                            <CSelect
                              v-else-if="
                                item.type.name.toLowerCase() === 'boolean'
                              "
                              horizontal
                              :options="[
                                { label: '请选择', value: '' },
                                { label: '是', value: true },
                                { label: '否', value: false },
                              ]"
                              :value.sync="item.default"
                              class="inputSelectTd"
                            ></CSelect>
                            <!--  dem_select  select可以下拉或者 file-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'dem_select' ||
                                item.type.name.toLowerCase() ===
                                  'base_index_select' ||
                                item.type.name.toLowerCase() === 'ref_select'
                              "
                            >
                              <template>
                                <i-select
                                  v-show="item.constraint.demCodeShow"
                                  class="inputTd"
                                  :id="`${item.name}`"
                                  :ref="`${item.name}`"
                                  v-model="item.default"
                                  filterable
                                  transfer
                                >
                                  <i-option
                                    v-for="item1 in item.constraint.values"
                                    :value="item1.value"
                                    :key="item1.value"
                                    >{{ item1.label }}
                                  </i-option>
                                </i-select>
                                <!-- <CButton
                                                                color="info"
                                                                size="sm"
                                                                @click="switchDemType(item)"
                                                                class="btnBrowser"
                                                                >d</CButton
                                                              > -->
                              </template>

                              <template>
                                <div v-show="!item.constraint.demCodeShow">
                                  <CInput
                                    v-model="item['default']"
                                    clearable
                                    autocomplete="off"
                                    class="inputTd"
                                    :title="
                                      item.default
                                        ? item.default
                                        : '双击文本框输入'
                                    "
                                    :placeholder="`${item.desc}`"
                                    @dblclick="onFocus(item)"
                                  />
                                  <CButton
                                    color="info"
                                    size="sm"
                                    @click="browserFile(item)"
                                    class="btnBrowser system-btn-style"
                                    >...
                                  </CButton>
                                </div>
                              </template>
                            </div>

                            <!--文件选项 dir-->
                            <div
                              v-else-if="item.type.name.toLowerCase() === 'dir'"
                            >
                              <template>
                                <CInput
                                  v-model="item.default"
                                  clearable
                                  autocomplete="off"
                                  class="inputTd"
                                  :title="
                                    item.default
                                      ? item.default
                                      : '双击文本框输入'
                                  "
                                  :placeholder="`${item.desc}`"
                                  @dblclick="onFocus(item)"
                                />
                                <CButton
                                  color="info"
                                  size="sm"
                                  @click="browserFile(item)"
                                  class="btnBrowser system-btn-style"
                                  >...
                                </CButton>
                              </template>
                            </div>
                            <!--文件选项 file-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'file'
                              "
                            >
                              <template horizontal>
                                <CInput
                                  v-model="item.default"
                                  clearable
                                  autocomplete="off"
                                  class="inputTd"
                                  :title="
                                    item.default
                                      ? item.default
                                      : '双击文本框输入'
                                  "
                                  :placeholder="`${item.desc}`"
                                  @dblclick="onFocus(item)"
                                />
                                <CButton
                                  color="info"
                                  size="sm"
                                  @click="browserFile(item)"
                                  class="btnBrowser system-btn-style"
                                  >...
                                </CButton>
                              </template>
                            </div>
                            <!--文件夹选择 spatialref-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'spatialref'
                              "
                            >
                              <template>
                                <CInput
                                  v-model="item.default"
                                  clearable
                                  autocomplete="off"
                                  class="inputTd"
                                  :title="item.default"
                                  :placeholder="`${item.desc}`"
                                />
                                <CButton
                                  color="info"
                                  size="sm"
                                  @click="browserRef(item)"
                                  class="btnBrowser system-btn-style"
                                  >...
                                </CButton>
                              </template>
                            </div>
                            <!-- <CInput v-else v-model="item.default" class="inputTd"></CInput> -->
                            <!--未知状态 float-->
                            <div
                              v-else-if="
                                item.type.name.toLowerCase() === 'float' ||
                                item.type.name.toLowerCase() === 'double' ||
                                item.type.name.toLowerCase() === 'int'
                              "
                              class="inputTd"
                            >
                              <Form
                                :model="item"
                                :rules="ruleCustom"
                                ref="item"
                              >
                                <FormItem
                                  prop="default"
                                  :rules="[
                                    {
                                      validator: (rule, value, callback) => {
                                        let data = item;
                                        if (!data.hasOwnProperty('constraint'))
                                          callback();
                                        let min = data.constraint.min;
                                        let max = data.constraint.max;
                                        let num = parseFloat(value);
                                        var reg = /-?[0-9]*\.?[0-9]+/;
                                        if (
                                          new RegExp(reg).test(value) == false
                                        ) {
                                          if (max == undefined) {
                                            callback(
                                              '请输入' + min + '以上的值'
                                            );
                                          } else
                                            callback(
                                              '请输入' +
                                                min +
                                                '-' +
                                                max +
                                                '之间的值'
                                            );
                                        } else {
                                          if (max == undefined) {
                                            if (num >= min) callback();
                                            else
                                              callback(
                                                '请输入' + min + '以上的值'
                                              );
                                          } else {
                                            if (num >= min && num <= max)
                                              callback();
                                            else {
                                              if (max == undefined)
                                                callback(
                                                  '请输入' + min + '以上的值'
                                                );
                                              else
                                                callback(
                                                  '请输入' +
                                                    min +
                                                    '-' +
                                                    max +
                                                    '之间的值'
                                                );
                                            }
                                          }
                                        }
                                      },
                                    },
                                  ]"
                                >
                                  <Input
                                    v-model="item.default"
                                    clearable
                                    autocomplete="off"
                                    placeholder="请输入数字"
                                    number
                                  />
                                </FormItem>
                              </Form>
                            </div>

                            <Input
                              v-else
                              v-model="item.default"
                              clearable
                              class="inputTd"
                              :placeholder="`${item.desc}`"
                              :title="item.default"
                              number
                            />
                          </div>
                        </template>
                      </CDataTable>
                    </td>
                  </tr>
                  <!--高级设置-->
                  <tr>
                    <td>
                      <!--基本参数的头部和下拉更多-->
                      <div class="tbHeader">
                        <span style="float: left"
                          >高级设置：
                          <Icon
                            type="ios-arrow-forward"
                            v-show="!advancedSetting"
                            @click="showAdvancedSetting"
                          />
                          <Icon
                            type="ios-arrow-down"
                            v-show="advancedSetting"
                            @click="advancedSetting = false"
                          />
                        </span>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td v-show="advancedSetting">
                      <!--基本参数的头部和下拉更多-->
                      <div
                        style="
                          display: flex;
                          text-align: left;
                          align-items: center;
                          background-color: #f9f9f9;
                        "
                      >
                        <div
                          style="
                            width: 170px;
                            display: flex;
                            justify-content: end;
                          "
                        >
                          计算分配策略：
                        </div>
                        <Select
                          v-model="pieRuntime.nodeSelector"
                          style="width: 345px"
                        >
                          <Option
                            v-for="item in nodeGroupList"
                            :value="item.groupLabel"
                            :key="item.groupName"
                            >{{ item.groupName }}</Option
                          >
                        </Select>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td v-show="advancedSetting">
                      <!--基本参数的头部和下拉更多-->
                      <div
                        style="
                          display: flex;
                          text-align: left;
                          align-items: center;
                          background-color: #f9f9f9;
                        "
                      >
                        <div
                          style="
                            width: 170px;
                            display: flex;
                            justify-content: end;
                          "
                        >
                          执行跳过环节：
                        </div>
                        <Select
                          v-model="pieRuntime.filterPreferenceData"
                          style="width: 345px"
                          multiple
                        >
                          <Option
                            v-for="item in filterPreference"
                            :value="item.value"
                            :key="item.label"
                            >{{ item.label }}</Option
                          >
                        </Select>
                      </div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
          </main>
        </div>
      </CCard>
      <!--任务描述和流程图-->
      <CCard class="rightCard" style="width: 37%">
        <CTextarea
          label="任务描述"
          placeholder="流程描述"
          v-model="taskdesc"
          horizontal
          disabled
        />
        <label class="processGraph">流程图</label>
        <div class="picDiv">
          <img
            :src="pictureSrc"
            alt
            ref="img1"
            class="img1"
            @click="clickImg($event)"
          />
        </div>
      </CCard>
    </CRow>
    <div class="inputStyle">
      <CInputCheckbox
        label="保存默认参数"
        type="radio"
        :checked.sync="defaultParamRadio"
        value="保存默认参数"
        style=""
      />
    </div>
    <!-- </div> -->
    <!--底部的执行和取消-->
    <!-- <template #footer> -->
    <!-- <div class="footDiv">
          <div style="text-align: center">
            <CButton
              @click="submit"
              color="info"
              class="btn1 system-btn-style"
              style="width: 82px"
              data-permission="Btn_Process_Run"
              title="流程执行"
              >执行
            </CButton>
            <CButton @click="batchParamCheck" color="info" class="btn1">参数校验</CButton>
            <CButton
              @click="closeModalOfTaskCreate"
              color="info"
              class="btn1 cancel-btn"
              style="width: 82px"
              >取消
            </CButton>
          </div>
          <div class="radioRight">
            <CInputCheckbox
              label="保存默认参数"
              type="radio"
              :checked.sync="defaultParamRadio"
              value="保存默认参数"
            />
          </div>
        </div> -->
    <!-- </template> -->
    <!-- </Modal> -->

    <!-- <Spin fix v-if="isLoading">
      <Icon type="ios-loading" size="80" class="demo-spin-icon-load"></Icon>
      <div>{{ loadingText }}</div>
    </Spin> -->

    <production-lineGraph
      ref="refProductionLineGraphModal"
      v-show="productionLineGraphModal"
      :modalShow="productionLineGraphModal"
      @close="productionLineGraphModalClose"
    ></production-lineGraph>

    <file-catalog
      ref="refFileCatalogModal"
      v-if="fileCatalogModal"
      :modalShow="fileCatalogModal"
      @closed="fileCatalogModalClose"
      @menuOk="fileCatalogModalOk"
    ></file-catalog>

    <SpatialReferenceManage
      ref="refSpatialRefManageModal"
      v-if="spatialRefManageModal"
      :modalShow="spatialRefManageModal"
      @closed="spatialRefManageModalClose"
      @spatialRefOk="spatialRefManageModalOk"
    ></SpatialReferenceManage>

    <Modal
      v-model="batchParamModal"
      draggable
      scrollable
      title="批量参数比对"
      :width="800"
      class="menuModal"
    >
      <p slot="header" class="modalHeader">批量参数比对</p>
      <CButtonClose slot="close" @click="batchCheckCancel" />
      <div>
        <CRow>
          <CCol sm="6" v-for="(items1, index) in paramList" :key="index">
            <div>{{ items1.label }}：</div>
            <select multiple class="batchSelect">
              <option
                v-for="(itemsli, index) in items1.defaultList"
                :key="index"
                @click="liClick(items1, index)"
                :title="itemsli"
              >
                {{ itemsli }}
              </option>
            </select>
          </CCol>
        </CRow>
      </div>
      <template #footer>
        <div style="float: left; width: 41%">
          <button @click="moveUp()" class="btn1" style="border: none">
            <img src="../../assets/icons/up.png" alt title="上移" />
          </button>
          <button @click="moveDown()" class="btn1" style="border: none">
            <img src="../../assets/icons/down.png" alt title="下移" />
          </button>
        </div>
        <CButton @click="batchCheckOk" color="info">确定</CButton>
        <CButton @click="batchCheckCancel" color="light ">取消</CButton>
      </template>
    </Modal>

    <CModal
      title="文件管理"
      color="info"
      size="xl"
      :show.sync="myFileModal"
      :closeOnBackdrop="false"
      centered
    >
      <template #header>
        <h5 class="modal-title">文件管理</h5>
        <CButtonClose @click="myFileCancel" />
      </template>
      <CCardBody>
        <div>
          <iframe
            :src="url"
            scrolling="no"
            marginheight="0"
            marginwidth="0"
            class="iframe"
          ></iframe>
        </div>
      </CCardBody>
      <template #footer>
        <CButton @click="myFileOk" color="info">确定</CButton>
        <CButton @click="myFileCancel" color="light" style="height: 40px"
          >取消
        </CButton>
      </template>
    </CModal>
  </div>
</template>

<!--js代码-->
<script>
// import loading from "../../../src/plugins/loading/loading"
import DatePickers from "../../plugins/date-pickers";
import FileCatalog from "../jobProcess/fileCatalog.vue";
import SpatialReferenceManage from "../jobProcess/spatialReferenceManage.vue";
import RegionSelectionComponent from "../jobProcess/regionSelectionComponent";
import ProductionLineGraph from "../jobProcess/processingGraph";

const items = [];
const typeOption = {
  0: "image",
  1: "parameter",
};

const fields = [
  //  { key: "groupName", label: "组名", _style: "width:20%" },
  { key: "label", label: "参数名称", _style: "width:20%;" },
  { key: "value", label: "参数值", _style: "width:80%;" },
];
const listproductLine = [];
export default {
  props: ["groupTreeId", "taskExeFlag", "selectResultRow"], //接受父组件传过来的值
  name: "common",
  data() {
    var validateCount = (rule, value, callback) => {
      if (!Number.isInteger(+value)) {
        callback(new Error("请输入数字"));
      } else if (Number.isInteger(+value)) {
        let length = value.length;
        if (length < 3) {
          callback(new Error("请输入长度为3的数字"));
        } else {
          callback();
        }
      } else {
        callback();
      }
    };
    return {
      filterPreference: [],
      appointmentTime: "", //新增预约时间
      pickerOptions: {
        //设置此时此刻之前的日期不可选
        disabledDate: function (time) {
          return time.getTime() < Date.now() - 8.64e7;
        },
      },
      isLoading: false,
      loadingText: "请稍后~",
      productionLineGraphModal: false,
      fileCatalogModal: false,
      spatialRefManageModal: false,
      modalStyle: { top: "340px" },
      globalDisplayBtn: false, //基本参数的显示按钮展开状态
      isExcute: false,

      taskdesc: "",
      // loading: true,
      showImg: false,
      imgSrc: "",
      showInputParameter: false,
      showGlobalParameter: false,

      inputMandatoryFlag: true, //记录算法参数必填项是否为空
      globalMandatoryFlag: true, //记录全局参数必填项是否为空

      url: "",
      myFileModal: false,
      isShowMyFile: false,

      validateCount: validateCount,
      ruleCustom: {
        count: [
          { required: true, message: "数量不能为空", trigger: "blur" },
          { validator: validateCount, trigger: "blur" },
        ],
        default: [
          { required: true, message: "请输入数字", trigger: "blur" },
          { validator: validateCount, trigger: "blur" },
        ],
      },
      paramList: [],
      batchParamModal: false,
      isBatch: true, // 根据这个字段来判断是单晶还是多晶
      id: "", //流程线父(组)ID
      type: "", //流程类型 image：影像 parameter：参量
      typeOption: typeOption, //流程类型内容模型 目前就两种 image parameter 可追加 避免后期代码中类型写死
      taskType: "", //提交任务类型
      userName: "",

      // formDate: {
      //   appointmentTime: "",
      // }
      listproductLine: [], //算法选择参数
      options: [
        //优先级
        { label: "普通", value: "0", isCheck: true },
        // { label: "优先", value: "1", isCheck: false },
      ],

      /***************** start 以下为参量属性设置 ************************/
      timeRow: false,
      sensorRow: false,
      productionTypeRow: false,
      algoModelRow: false,
      productionLineRow: true,

      timeType: "month",
      timePlaceholder: "请选择月份",
      timeFormat: "yyyy-MM",
      currentTime: new Date(),

      timeList: [
        { label: "月度", value: "月度", isCheck: true },
        // { label: "季度", value: "季度", isCheck: false },//暂时隐藏
        { label: "年度", value: "年度", isCheck: false },
      ],

      mixType: [
        { label: "最小值", value: "Min ", isCheck: true },
        { label: "最大值", value: "Max", isCheck: false },
        { label: "累计值", value: "Acc", isCheck: false },
        { label: "均值", value: "Ave", isCheck: false },
        { label: "加权平均值", value: "WAve", isCheck: false },
      ],
      mixTypeValue: "Min",
      productionType: [
        { label: "单景产品", value: "单景产品", isCheck: true },
        { label: "合成产品", value: "合成产品", isCheck: false },
      ],

      productionTypeValue: "单景产品",
      sensorOption: [],
      sensorOptionValue: 0,
      algoTypeOption: [],
      algoTypeOptionValue: 0,
      filterLabels: "", //参量流程筛选条件标签
      regionTitle: "",
      regionCascader: [
        {
          label: "全国",
          value: 0,
          loading: false,
          tag: "china",
          code: "0",
          children: [],
        },
        // { label: "其他", value: 1, loading: false, tag: "other", code:1,children: [] },
      ], //级联选择
      cascaderValue: [],
      isRegion: false,
      region: {
        name: "",
        geometry: "",
      },
      regionType: [
        { label: "行政区", value: "xzq ", isCheck: true },
        // { label: "重要保护地", value: "other", isCheck: false }
        // { label: "重点区域", value: "other", isCheck: false }
      ],
      currentRegionType: "xzq",
      /*****************end 以上为参量属性设置 ************************/

      suffix: [],
      currenSelectSuffix: "",
      // items: items.map((item, id) => {
      //   return { ...item, id };
      // }),
      items: [],

      inputDisplayParamItems: [], //算法参数表格默认显示
      inputParamItems: [], //表格显示和隐藏全部参数 用于提交数据
      hiddenImputDtParam: [], //算法参数表格隐藏参数 用于显示更多和隐藏
      displayInputDtParam: [], //算法参数表格显示参数

      globalItemsDisplayItems: [], //基本参数表格默认显示
      globalItems: [], //基本参数表格全部数据 用于提交数据
      hiddenGlobalDtParam: [], //基本参数表格隐藏参数 用于显示更多和隐藏 暂时功能没有用到
      displayGlobalDtParam: [], //基本参数表格显示参数

      fields,
      taskName: "",
      currentItem: "",
      workflowId: "",
      workflowName: "",
      pictureSrc: "",
      priorityLevel: 0,
      isPriorShow: false,
      showCreateTaskModal: false,
      defaultParamRadio: false,
      haveHeader: false,
      selectBatchParamData: new Object(),
      refDem: "", //用于dem_select 和dem_index_select dem类型数据的ref动态传参中介
      /*高级设置选项*/
      advancedSetting: false,
      nodeGroupList: [
        {
          value: "New York",
          label: "New York",
        },
        {
          value: "London",
          label: "London",
        },
        {
          value: "Sydney",
          label: "Sydney",
        },
        {
          value: "Ottawa",
          label: "Ottawa",
        },
        {
          value: "Paris",
          label: "Paris",
        },
        {
          value: "Canberra",
          label: "Canberra",
        },
      ],
      pieRuntime: {
        nodeSelector: "",
        filterPreferenceData: [],
      },
    };
  },
  components: {
    DatePickers,
    FileCatalog,
    SpatialReferenceManage,
    RegionSelectionComponent,
    ProductionLineGraph,
  },
  watch: {
    $route: {
      handler() {
        alert("getProduct");
        this.id = this.$route.params.id;
        this.type = this.$route.params.type;
        // this.getProduct();
      },
      deep: true,
    },

    taskName(newVal, oldVal) {
      if (newVal.length >= 100) {
        // this.$Message.error("任务名称长度不得超过100个字符");
      }
    },
    //新增的几个字段，父子组件之间传值
    groupTreeId(newVal, oldVal) {

      this.id = newVal;
      this.getCommonProduct();
    },
    taskExeFlag(newVal, oldVal) {
      this.taskExeFlag = newVal;
      if (this.taskExeFlag == true) {
        this.submit();
      } else if (
        this.inputMandatoryFlag == false ||
        this.globalMandatoryFlag == false
      ) {
        //算法必填项存在为空的情况
        return;
      }
    },

    isExcute(newVal, oldVal) {
      if (newVal == true) {
        // this.toRoute();
      }
    },
  },
  created() {
    this.setPriorPermission();
  },
  mounted() {
    let dataList = document.querySelectorAll(".fileCatalogModal");
    for (let i = 0; i < dataList.length; i++) {
      dataList[i].parentNode.removeChild(dataList[i]);
    }

    this.id = this.$route.params.id;
    this.type = this.$route.params.type;
    let name = this.$route.name;
    if (name === "commonQualityCheck") {
      this.taskType = 1;
    } {
      this.taskType = 2;
    }

    this.userName = window.sessionStorage.getItem("user");
    this.layoutByType();
    this.getNodeGroupList();

    // this.getProduct();
  },
  methods: {
    //显示高级设置
    showAdvancedSetting() {
      this.advancedSetting = true;

      // this.filterPreferenceData();
    },
    //过滤算法
    filterPreferenceData() {
      let that = this;
       this.pieRuntime.filterPreferenceData = []
        this.filterPreference = [];
    //    console.log(this.workflowId,'---this.workflowId')
      let path = this.$api.monitorApi.selectFilterData + this.workflowId;
      this.http.get(path).then((res) => {
       res.data.data.algList.forEach((ele) => {
          // ele.taskReferenceName
 if (ele.taskReferenceName != null) {
          this.filterPreference.push({
            value: ele.taskReferenceName,
            label: decodeURI(ele.label),
          });
 }
        });
      });
    },
    /*获取高级设置的节点组*/
    getNodeGroupList() {
      let that = this;
      this.http
        .get(this.$api.monitorApi.getNodeGroup, {})
        .then((res) => {
          if (res.data.code == 0) {
            that.nodeGroupList = [
              { groupName: "所有节点", groupLabel: "0", id: "xx" },
            ].concat(res.data.data.nodeGroupList);
          } else {
            this.$Message.error(res.message);
          }
        })
        .catch((err) => {
          this.$Message.error(err.message);
        });
    },

    onFocus(item) {
      let info = "";

      this.selectResultRow.forEach((ele) => {
        if (info == "") info = ele.image_src_path;
        else if (this.isBatch) {
          info += "#HT#" + ele.image_src_path;
        } else {
          info += "#TASK#" + ele.image_src_path;
        }
      });
      item.default = info;
    },

    // setQuery(value, item) {
    //   let refObj = this.$refs[`${item.name}`];
    //   refObj = refObj[0];
    //   refObj.setQuery(value);
    //   this.$nextTick(function () {
    //     this.$set(item.tempDefault, value);
    //   });
    // },
    selectChange(data, itemZ, list) {

      // 0表示全路径   1表示文件夹

      if (!list) return;
      let that = this;
      list.forEach((item) => {
        if (
          item.binding &&
          item.binding.name == itemZ.name &&
          item.binding.value == data
        ) {
          that.$set(item, "selectItem", false);
        }
        if (
          item.binding &&
          item.binding.name == itemZ.name &&
          item.binding.value != data
        ) {
          that.$set(item, "selectItem", true);
        }
      });
    },
    //将时间转换为yyyy-MM-dd HH:mm:ss格式
    // dateFormat(){
    //   let timeNow = new Date();//获取当前时间
    //   let year = timeNow.getFullYear();
    //   let month = timeNow.getMonth() + 1;
    //   month = month < 10 ? ('0' + month) : month;
    //   let day = timeNow.getDate();
    //   day = day < 10 ? ('0' + day) : day;
    //   let hour = timeNow.getHours();
    //   hour = hour < 10 ? ('0' + hour) : hour;
    //   let minute = timeNow.getMintues();
    //   minute = minute < 10 ? ('0' + minute) : minute;
    //   let second = timeNow.getSeconds();
    //   second = second < 10 ? ('0' + second) : second;
    //   let nowTime = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;

    // },
    setPriorPermission() {
      let permissionList = this.$store.getters.getSystemPermissions;
      //没有操作权限
      if (permissionList.length < 1) return;
      let arr = permissionList.filter((ele) => {
        return (
          ele.code === "Btn_Process_Priority" &&
          ele.visibleFlag == 0 &&
          ele.enableFlag == 0
        );
      });
      if (arr.length < 1) return;
      this.isPriorShow = true;
      let obj = { label: "优先", value: "1", isCheck: false };
      this.options.push(obj);
    },
    //每次输入框内容改变的时候触发的方法
    // isQueryChange: function (value, item, index) {
    //   let refName = item.name;
    //   let refObj = this.$refs[`${item.name}`];
    //   refObj = refObj[0];
    //   //调整iview的样式，filterQueryChange是为了关闭iview的过滤功能，另外需要隐藏掉iview的allow-create添加的弹出层
    //   this.$nextTick(function () {
    //     refObj.filterQueryChange = false;
    //     $(refObj.$el).find(".ivu-select-item-enter").parent().parent().hide(); // 隐藏allowCreate弹出层
    //     // $("#" + refName)
    //     //   .find(".ivu-select-item-enter")
    //     //   .parent()
    //     //   .hide();
    //   });

    //   let list = item.constraint.values;
    //   let isExist = false;
    //   //根据输入的值到list中找，如果输入的值和list中的label匹配，那么将匹配值的value赋值给绑定值和实际值
    //   for (let i = 0; i < list.length; i++) {
    //     if (list[i].label == value) {
    //       item.tempDefault = list[i].value;
    //       item.constraint.defaultType = "code";
    //       setTimeout(function () {
    //         //为了解决iview的小bug，将选中的阴影效果转移到选中的值上（iview选中一个值后，字体会变成蓝色，背景会变成暗灰色，但是不明白为什么要把二者的数据绑定分开，这个bug会导致如果非页面手动点击（比如页面初始化后），被选择的值的背景是白色的，但是手动点击是灰色的）
    //         refObj.focusIndex = i;
    //       }, 0);
    //       item.default = list[i].value;
    //       isExist = true;
    //     }
    //   }
    //   if (!isExist) {
    //     //如果前边的list中没有输入的值，此时不应该选中任何值，所以先把选择框绑定的值设置为空
    //     //此时需要提交后台的值就是自定义输入的值，赋值给实际值
    //     item.tempDefault = "";
    //     item.default = value;
    //     item.constraint.defaultType = "path";
    //     //这里是为了解决iview的小bug，清除掉选中后的阴影效果

    //     refObj.focusIndex = -1;
    //   }
    // },
    //根据数据的类型和模块 控制界面的显示 image 影像 parameter 参量 参量界面只在处理加工界面 质检不涉及
    layoutByType() {
      let type = this.type;
      if (type === this.typeOption[1] && this.taskType === 2) {
        this.sensorRow = true;
        this.productionTypeRow = true;
        this.algoModelRow = true;
      }
    },
    toRoute() {
      if (this.taskType == 1) {
        this.$router.push({
          path: "/qualityCheck",
          query: {
            from: "qualityCheckCommon",
          },
        });
      } else if (this.taskType == 2) {
        this.$router.push({
          path: "/processing",
          query: {
            from: "processingCommon",
          },
        });
      }
    },
    tdRightImg(type) {
      let img = {
        plus: require("./../../assets/icons/leftArrow.svg"),
        reduce: require("./../../assets/icons/downArrow.svg"),
      };
      return img[type];
    },
    clickImg(e) {
      this.productionLineGraphModal = true;
      this.$refs.refProductionLineGraphModal.displayProductionLineGraph(
        this.pictureSrc
      );
    },
    productionLineGraphModalClose() {
      this.productionLineGraphModal = false;
    },
    // ----------------------------以下批量参数比对功能部分 ---------------------------------//

    batchCheckOk() {
      this.batchParamModal = false;
      let batchData = this.paramList;
      let tableData = this.items;
      let flag = 0;
      for (let i in batchData) {
        //目的是替换表格数据this.items中对应的批量数据替换
        let temp = batchData[i];
        let info = "";
        for (let m in temp.defaultList) {
          if (info == "") info = temp.defaultList[m];
          else info += "#HT#" + temp.defaultList[m];
        }
        for (let j in tableData) {
          //比对表格this.items中每个算法下每个参数的workflowInputKey是否相对 y 替换 n 不变
          let tempData = tableData[j];
          for (let n in tempData) {
            let tempData2 = tempData[n];
            if (temp.workflowInputKey === tempData2.workflowInputKey) {
              this.$nextTick(function () {
                this.$set(this.items[j][n], "default", info);
              });
              flag++;
            }
            if (flag == batchData.length) break;
          }
          if (flag == batchData.length) break;
        }
      }
    },
    batchCheckCancel() {
      this.batchParamModal = false;
    },
    moveUp() {
      let childrenData = this.selectBatchParamData;
      let index = this.getIndex();
      let list = [];
      list = childrenData.data.defaultList;
      let childIndex = childrenData.index;
      if (list.length > 1 && childIndex != 0) {
        var temp = list[childIndex - 1];
        list[childIndex - 1] = list[childIndex];
        list[childIndex] = temp;
        this.paramList[index].defaultList = [];
        this.$nextTick(function () {
          this.$set(this.paramList[index], "defaultList", list);
        });
      }
    },
    moveDown() {
      let childrenData = this.selectBatchParamData;
      let index = this.getIndex();
      let list = [];
      list = childrenData.data.defaultList;
      let childIndex = childrenData.index;
      if (list.length > 1 && childIndex != list.length - 1) {
        var temp = list[childIndex + 1];
        list[childIndex + 1] = list[childIndex];
        list[childIndex] = temp;
        this.paramList[index].defaultList = [];
        this.$nextTick(function () {
          this.$set(this.paramList[index], "defaultList", list);
        });
      }
    },
    getIndex() {
      let data = this.paramList;
      let childrenData = this.selectBatchParamData;
      //1 根据childrenData得到在父data数组中的索引值
      //2、改变childrenData的上移和下移动后的数据
      //3、根据索引值改变data的对应的值用移动后的数据替换
      let index = 0;
      let flag = false;
      for (let i in childrenData) {
        let tempData = childrenData[i].workflowInputKey;
        for (let j in data) {
          let tempData1 = data[j].workflowInputKey;
          if (tempData === tempData1) {
            index = j;
            flag = true;
            break;
          }
        }
        if (flag) break;
      }
      return index;
    },
    liClick(item, index) {
      let obj = new Object();
      obj.data = item;
      obj.index = index;
      this.selectBatchParamData = obj;
    },
    //批量参数校验 初始化参数
    batchParamCheck() {
      let dataList = this.items;
      let newDataList = [];
      let list = [];
      let obj = new Object();
      for (var i in dataList) {
        for (let j in dataList[i]) {
          let tempData = dataList[i][j];
          obj = tempData;
          if (
            tempData.type.name.toLowerCase() === "file" ||
            tempData.type.name.toLowerCase() === "dir"
          ) {
            if (
              tempData.workflowInputKey.indexOf("pan") != -1 ||
              tempData.workflowInputKey.indexOf("mss") != -1
            ) {
              if (
                tempData.type.plural &&
                tempData.default.indexOf("#HT#") != -1
              ) {
                let tempList1 = tempData.default.split("#HT#");
                obj.defaultList = tempList1;
                newDataList.push(obj);
              }
            }
          }
        }
      }
      this.paramList = newDataList;
      if (newDataList.length > 0) this.batchParamModal = true;
      else this.$Message.info("没有可以比对的数据");
    },
    // ----------------------------以上批量参数比对功能部分 ---------------------------------//
    closeModalOfTaskCreate() {
      this.showCreateTaskModal = false;
      this.$bus.$emit("getCatalog");
      this.toRoute();
    },
    //对应流程线的流程图
    displayProductionLineGraph() {
      let workFlowId = this.workflowId;
      let path =
        this.$api.processingApi.loopUpGraph + workFlowId + "/findPicture";
      this.pictureSrc = path;
    },
    //数据获取入口
    getProduct() {
      let _this = this;
      if (_this.type === _this.typeOption[1] && _this.taskType === 2) {
        _this.getParameterFilterLabels();
      } else {
        _this.getCommonProduct();
      }
    },
    getParameterFilterLabels() {
      let _this = this;
      let path = _this.$api.processingApi.queryProcessLabels;
      let param = {
        groupId: _this.id,
      };
      _this.sensorOption = [];
      _this.algoTypeOption = [];
      _this.http.get(path, param).then((res) => {
        let data = res.data;
        if (data.code == 0 && data.success) {
          let labelData = data.data;
          _this.showCreateTaskModal = true;
          let productionType = [];

          Object.keys(labelData).forEach(function (key) {
            let tempDataArr = labelData[key];
            tempDataArr.forEach((ele, index) => {
              let value = {};
              value[key] = [];
              value[key].push(ele);

              let obj = {};
              obj.label = ele;
              obj.value = value;
              obj.isCheck = false;

              // ProducType-产品类型: ["单景产品"]
              if (key.indexOf("SatelliteSensor") != -1) {
                let fist = key.split("-")[0].length;
                let resultData = key.substring(fist + 1, key.length);

                obj.label = resultData + "-" + ele;
                _this.sensorOption.push(obj);
              } else if (key.indexOf("ProducClass") != -1) {
                _this.algoTypeOption.push(obj); //算法模型
              } else if (key.indexOf("ProducType") != -1) {
                productionType.push(obj); //产品类型
              }
            });
          });

          _this.sensorOptionValue =
            _this.sensorOption.length < 1 ? "" : _this.sensorOption[0].value;
          _this.algoTypeOptionValue =
            _this.algoTypeOption.length < 1
              ? ""
              : _this.algoTypeOption[0].value;

          let value1 = { "ProducType-产品类型": ["单景产品"] };
          _this.productionTypeValue = value1;

          // _this.productionTypeValue =
          //   productionType.length < 1 ? value1 : productionType[0].value;

          _this.filterProcessByConditons();
        } else {
          this.$Message.error(res.message);
        }
      });
    },
    //流程任务执行
    submit() {
      let _this = this;
      if (!this.taskName) {
        this.$Message.warning("任务名称没有填哦！");
        return false;
      }

      if (this.taskName.length > 100) {
        this.$Message.warning("任务名称不能超过100个字符!");
        return false;
      }

      //判断预约时间是否满足要求
      if (this.appointmentTime) {
        let timeNowStamp = new Date().getTime(); //获取当前时间的时间戳
        let appointmentTimeStamp = Date.parse(this.appointmentTime); //获取预约时间的时间戳
        let differ = (appointmentTimeStamp - timeNowStamp) / 1000 / 60; //两个时间的差值，单位为分钟
        if (differ < 30) {
          this.$Message.warning("预约时间必须为当前时间的30分钟之后!");
          return false;
        }
      }

      // this.showCreateTaskModal = false;
      // this.isLoading = true;
      // let inputParamData = this.inputParamItems;
      let defaultParam = { inputParam: [] };

      defaultParam.globalParam = this.globalItems; //globalParam
      defaultParam.multiImage = !this.isBatch;
      _this.dealWithSubmitGlobalParameter(); // 基本参数
      if (this.globalMandatoryFlag == false) {
        return false; //传递给父组件  说明有必填项没填的情况
      } else {
        _this.dealWithSubmitInputParameter(defaultParam); //算法参数
        if (this.inputMandatoryFlag == false) {
          return false;
        }
      }
    if( !this.pieRuntime.filterPreferenceData.length){
      this.pieRuntime.filterPreferenceData = []
      }
      let submitPath = this.$api.processingApi.submitTask;
      let department = _this.$store.state.user.department;
      let params = {
        item: JSON.stringify(defaultParam),
        workflowId: this.workflowId,
        name: this.taskName,
        priorityLevel: this.priorityLevel,
        userId: 0,
        taskType: this.taskType, //1 质检 2 数据处理
        isSaveDefaultParameter: this.defaultParamRadio,
        taskOwner: this.userName,
        department: !department ? "" : department,
        appointmentTime: this.appointmentTime, //新增预约时间
        skipTaskReferenceNames: this.pieRuntime.filterPreferenceData, //过滤算法字段
      };

      if (!this.pieRuntime.nodeSelector) {
        delete this.pieRuntime.nodeSelector;
      } else {
        this.pieRuntime.nodeSelector = JSON.parse(
          _this.pieRuntime.nodeSelector
        );
      }

      params.runtime = JSON.parse(JSON.stringify(_this.pieRuntime));

      this.http.post(submitPath, params).then((res) => {
        _this.isExcute = true;
        if (res.data.success) {
          this.$Message.success("提交任务成功");
          // this.isLoading = false;
          return true;
        } else {
          this.$Message.error("提交失败:" + res.data.message);
          //  return false;
        }
      });
    },
    //radio算法选择显示流程参数切换
    searchProductLine(item, index) {
      this.workflowId = item.id;
      this.taskdesc = item.description;
      this.getProcessParamsByWorkflowId();
      this.displayProductionLineGraph();
        this.filterPreferenceData();
    },
    // 校验基本参数
    dealWithSubmitGlobalParameter() {
      let globalParamData = this.globalItems;

      if (!globalParamData) return;

      for (let j = 0; j < globalParamData.length; j++) {
        if (
          globalParamData[j].mandatory == "true" &&
          (globalParamData[j].default === null ||
            globalParamData[j].default === "")
        ) {
          this.$Message.warning(globalParamData[j].label + "的值不能为空！");
          this.globalMandatoryFlag = false; //  标记
          break;
        } else {
          this.globalMandatoryFlag = true;
        }
      }
    },
    //  处理动态参数
    dealWithSubmitInputParameter(defaultParam) {
      let _this = this;
      let inputParamData = this.inputParamItems; //参数为二维数组的形式
      for (var i in inputParamData) {
        //遍历二维数组
        let inputData = inputParamData[i]; //一维数组
        let productionTypeValue = JSON.stringify(_this.productionTypeValue);
        if (
          productionTypeValue.indexOf("合成") != -1 &&
          inputData[0].groupAlgoId === "piesat.java.generate_production_name"
        ) {
          _this.dealWithMixProductData("paramMix", inputData);
        }
        if (
          productionTypeValue.indexOf("合成") != -1 &&
          inputData[0].groupAlgoId.indexOf("piesat.basic.img_clip") != -1
        ) {
          //algoId: piesat.basic.img_clip_enhance; piesat.basic.img_clip
          _this.dealWithMixProductData("imgClip", inputData);
        }
        if (
          productionTypeValue.indexOf("合成") != -1 &&
          inputData[0].groupAlgoId.indexOf(
            "piesat.basic.create_metadata_synthesis"
          ) != -1
        ) {
          _this.dealWithMixProductData("metadata", inputData);
        }
        for (let j = 0; j < inputData.length; j++) {
          if (
            inputData[j].mandatory == true &&
            (inputData[j].default === null || inputData[j].default === "")
          ) {
            this.$Message.warning(inputData[j].label + "的值不能为空！");
            this.inputMandatoryFlag = false; //  标记
            break;
          } else {
            this.inputMandatoryFlag = true; //正常情况的值置为true
          }
        }
        if (this.inputMandatoryFlag == false) break;

        defaultParam.inputParam.push(inputData);
      }
    },
    dealwithSpecialParam(data) {
      for (let i = 0; i < data.length; i++) {
        //todo base_index_select的default多个路径是非数组格式
        // if (data[i].type.name === "base_index_select") {
        //   data[i].default = data[i].default;
        // }
        //todo dem_select和ref_select的default多个路径是数组格式
        //  if (data[i].type.name === "dem_select"||data[i].type.name==='ref_select') {
        //   data[i].default = data[i].default;
        // }
        // if (data[i].type.name === "json_object") {
        //   data[i].default = JSON.parse(JSON.stringify(data[i].default));
        //   break;
        // }
      }
    },
    dealWithMixProductData(type, data) {
      //参量-合成产品 所需要的的提交区域和时间尺度
      data.forEach((ele) => {
        switch (type) {
          case "paramMix":
            if (ele.name === "region") {
              ele.default = this.region.name;
            } else if (ele.name === "submitTime") {
              let time = this.currentTime.split("-").join("");
              if (time.length > 4 && time.length < 7) time = time + "m"; //month
              ele.default = time;
            } else if (ele.name === "method") {
              ele.default = this.mixTypeValue;
            }
            break;
          case "imgClip":
            if (ele.name === "InputGeoJson" || ele.name === "ClipRange") {
              ele.default = this.region.geometry;
              break;
            }
            break;
          case "metadata":
            if (ele.name === "RegionType") {
              // ele.default = this.region.classify;
            } else if (ele.name === "RegionCode") {
              ele.default = this.region.code;
            } else if (ele.name === "RegionName") {
              ele.default = this.region.name;
            }
            break;
        }
      });
    },
    getSelectRegionValue(data) {
      this.region = data;
    },
    dateFormat(fmt, date) {
      if (!date) {
        date = new Date();
        this.dateFormat("YYYY-mm", date);
        return;
      }
      if (date.toString().indexOf("-") != -1) return;
      let ret;
      const opt = {
        "Y+": date.getFullYear().toString(), // 年
        "m+": (date.getMonth() + 1).toString(), // 月
        "d+": date.getDate().toString(), // 日
        "H+": date.getHours().toString(), // 时
        "M+": date.getMinutes().toString(), // 分
        "S+": date.getSeconds().toString(), // 秒
        // 有其他格式化字符需求可以继续添加，必须转化成字符串
      };
      for (let k in opt) {
        ret = new RegExp("(" + k + ")").exec(fmt);
        if (ret) {
          fmt = fmt.replace(
            ret[1],
            ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")
          );
        }
      }
      return fmt;
    },
    //根据流程id获取流程参数信息
    getProcessParamsByWorkflowId() {
      String.prototype.bool = function () {
        return /^true$/i.test(this);
      };

      let _this = this;
      // let userName = "///"
      // let workFlowId = "//"

      this.globalDisplayBtn = false;
      let token = window.sessionStorage.getItem("PIECloud-Token");
      /*if (!token) return;*/
      let path = _this.$api.processingApi.searchProcessParameters;
      let param = {
        userName: _this.userName,
        workFlowId: _this.workflowId,
      };

      _this.http.get(path, param).then((res) => {
        _this.displayInputDtParam = []; //表格显示数据置空
        _this.hiddenImputDtParam = [];

        let data = res.data;
        if (data.success) {
          let params = JSON.parse(data.data.processParameters);
          let inputParam = params.inputParam;
          let globalParam = params.globalParam;

          //批量拆分的标识入口 默认是单景的 即批量的数据 （单景和多景的数据都支持文件多选）
          // 这个参数是描述流程本身的，多景处理为true表示流程本身能一次处理多景数据，所以不支持批量拆分，
          // 多景处理默认是false，表示流程本身一次只能处理一景数据，但是提交任务的时候可以批量拆分成多个任务进行并行处理
          let multiImage = JSON.parse(data.data.processParameters).multiImage;

          if (typeof multiImage === "boolean") {
            this.isBatch = !multiImage;
          } else {
            this.isBatch = multiImage ? !multiImage.bool() : true;
          }
          //基本参数的显示和隐藏

          if (globalParam) {
            _this.dealWithGlobalParameterBeforeRender(globalParam);
          }

          //算法参数显示&&隐藏
          this.showInputParameter = true;
          for (let i = 0; i < inputParam.length; i++) {
            let workflowInputKey = inputParam.workflowInputKey;
            _this.dealWithAlgoParameterBeforeRender(inputParam[i]);
          }

          _this.inputDisplayParamItems = this.displayInputDtParam; //inputParam;
          _this.inputParamItems = inputParam; //表格参数全部数据
          let outPathIsdir = inputParam[0].find((item) => {
            return item.name === "out_path_isdir";
          });
          if (outPathIsdir) {
            _this.selectChange(outPathIsdir.default, outPathIsdir);
          }

          if (!globalParam || globalParam.length < 1) {
            // if (this.displayGlobalDtParam.length < 1) {
            _this.showGlobalParameter = false;
            _this.showInputParameter = true;

            _this.globalItemsDisplayItems = [];
            _this.globalItems = undefined;
          } else {
            _this.showGlobalParameter = true;
            _this.showInputParameter = false;

            _this.globalItemsDisplayItems = this.displayGlobalDtParam;
            _this.globalItems = globalParam;
            // _this.globalItems = JSON.parse(JSON.stringify(globalParam)); //deep copy
          }
        } else {
          _this.$Message.error(res.data.message);
        }
        _this.$nextTick(() => {
          _this.setDisplayHidBtnStyle();
        });
      });
    },
    dealWithGlobalParameterBeforeRender(param) {
      let _this = this;
      let display = [];
      let hidden = [];
      for (let i = 0; i < param.length; i++) {
        let tempValue = param[i];

        //将selet类型的值有字符串转数字
        var Regx = /^[0-9]+$/;
        if (Regx.test(tempValue.default)) {
          if (tempValue.type.name === "select" && tempValue.default) {
            tempValue.default = parseInt(tempValue.default);
          }
        }

        // 控制文件夹全路径
        if (tempValue.label == "输出路径类型" && param) {
          this.selectChange(tempValue.default, tempValue, param);
        }

        this.commonBeforeRender(tempValue);
        //控制基本参数的显示和隐藏
        if (tempValue.display && tempValue.display.tag) {
          display.push(tempValue);
          // if (tempValue.display.value) display.push(tempValue);
          // else hidden.push(tempValue);
        } else {
          // count++;
          hidden.push(tempValue);
        }
      }
      // if (count == param.length) {
      //   this.showGlobalParameter = false;
      // }
      // if (hidden.length < 1) hidden.isDisplay = false;
      _this.hiddenGlobalDtParam = hidden; //显示和隐藏的时候需要更新维护 暂时没有用到
      _this.displayGlobalDtParam = display; //只在表格初始化的时候用一次
    },
    dealWithAlgoParameterBeforeRender(data) {
      let _this = this;
      let display = [];
      let hidden = [];
      let isHaveParameterShow = true; //用于标识算法参数是否全部隐藏了 是 则界面不显示算法的名字（参数的显示隐藏由流程编排复选框控制）
      let count = 0;
      for (let j = 0; j < data.length; j++) {
        let tempValue = data[j];
        let defaultVal = tempValue.default;

        //select类型数据单独处理（处理default为object情况 正确为字符串或者数字、boolean等）
        if (
          tempValue.type.name.toLowerCase() === "select" &&
          typeof defaultVal === "object"
        ) {
          tempValue.default = defaultVal.value;
        }

        // 控制文件夹全路径
        if (tempValue.label == "输出路径类型" && data) {
          this.selectChange(tempValue.default, tempValue, data);
        }

        this.commonBeforeRender(tempValue);
        //元数据算法控制生产员 质检员显示
        if (
          tempValue.groupAlgoId === "piesat.basic.create_metadata" ||
          tempValue.groupAlgoId == "piesat.basic.create_metadatapainv"
        ) {
          if (_this.taskType == 1 && tempValue.label.indexOf("生产员") != -1) {
            //质检
            data.splice(j, 1); //删除索引i的1个元素
            j--; //必须有
            continue;
          } else if (
            _this.taskType == 2 &&
            tempValue.label.indexOf("质检员") != -1
          ) {
            //处理加工
            data.splice(j, 1);
            j--;
            continue;
          }

          let value = "";
          if (tempValue.label.indexOf("姓名") != -1) {
            value = window.sessionStorage.getItem("user");
            tempValue.default = !value ? "" : value;
          }
          if (tempValue.label.indexOf("部门") != -1) {
            value = _this.$store.state.user.department; //产品的版本可以注释掉
            tempValue.default = !value ? "" : value;
          }
        }

        /**前端界面显示分两种 第二种取决于第一种
         *  第一种（优先级高） 根据流程编排的参数复选框的选择状态判断(display.tag):
         *  若打钩显示（则逻辑+第二种）   若不勾 页面不管是显示更多还是隐藏都不显示 但执行时该参数信息仍然传到后端
         *  第二种 根据参数值（default）有无判断 有(display.value=false) 不显示 没有 则显示
         **/

        /**后端逻辑：
         * 1.流程编排的参数display=true时  tag 为 true;
         *  参数值为空  value:true; 参数值不为空时value:false; 所以当display是true,参数值为空时:display：{tag:true,value:true}
         *  2.display为false tag和value  都是false 前端不予显示*/

        // 只有当tag为true时 再判断参数值是否为空问题
        // tag为false时,则不考虑，界面始终不显示
        if (tempValue.hasOwnProperty("display") && tempValue.display.tag) {
          if (tempValue.display.value) display.push(tempValue);
          else hidden.push(tempValue);
        } else {
          // 在界面不显示 但是执行时该值将传到算法中
          count++;
        }
      }

      if (count == data.length) {
        isHaveParameterShow = false;
      }

      // 显示&&隐藏控制（显示更多和隐藏数据）
      if (!isHaveParameterShow) return;
      if (hidden.length < 1) hidden.isDisplay = false;

      display.groupName = data[0].groupName;
      hidden.groupName = data[0].groupName;

      _this.hiddenImputDtParam.push(hidden); //显示和隐藏的时候需要更新维护
      _this.displayInputDtParam.push(display); //只在表格初始化的时候用一次
    },

    //基本参数和算法参数的特殊处理
    commonBeforeRender(tempValue) {
      if (
        (tempValue.type.name.toLowerCase() === "double" ||
          tempValue.type.name.toLowerCase() === "float" ||
          tempValue.type.name.toLowerCase() === "int") &&
        tempValue.default
      ) {
        tempValue.default = Number(tempValue.default);
      }

      if (tempValue.type.name.toLowerCase() === "json_object") {
        if (tempValue.default instanceof Object == true)
          tempValue.default = JSON.stringify(tempValue.default);
      }
      if (tempValue.type.name.toLowerCase() === "project_image") {
        if (
          tempValue.default != null &&
          tempValue.default instanceof Array == true
        )
          tempValue.default = JSON.stringify(tempValue.default);
      }

      // dem_select：用于选择dem数据，值为数组格式
      // ref_select：用于选择参考影像，值为数组格式；
      // base_index_select：用于选择基准索引，值为字符串file类型 不是数组；
      let nameType = tempValue.type.name.toLowerCase();

      if (
        nameType.indexOf("dem_select") != -1 ||
        nameType.indexOf("base_index_select") != -1 ||
        nameType.indexOf("ref_select") != -1
      ) {
        if (!tempValue.constraint) {
          tempValue.constraint = {};
        }
        tempValue.constraint.values = [];
        tempValue.constraint.demCodeShow = true;
        this.getDemOptions(tempValue, tempValue.type.name);
      }
    },
    getDemOptions(item, type) {
      let path = this.$api.processingApi.getDemType;
      let param = {
        code: type, //根据dem类型查对应的服务数据
      };
      this.http.get(path, param).then((res) => {
        if (res.data.code == 0 && res.data.success) {
          let options = [];
          let demArr = res.data.data;
          if (JSON.stringify(demArr) != "[null]") {
            demArr.forEach((ele) => {
              options.push({ label: ele.name, value: ele.code });
            });
          }
          if (options.length < 1) {
            item.constraint.demCodeShow = false;
            // item.constraint.defaultType = "path";
            // if (item.constraint.defaultType == "code") {
            //   item.default = "";
            // }
          } else {
            item.constraint.values = options;
            // item.constraint.defaultType = "code";
          }
        } else {
          this.$Message.error(res.data.message);
        }
      });
    },
    switchDemType(item) {
      item.constraint.demCodeShow = !item.constraint.demCodeShow;
    },
    //基本参数控制算法参数的显示和隐藏
    setDisplayHidBtnStyle() {
      //对显示隐藏按钮样式做判断
      let id = "globalParamId";
      let img = $("#" + id).find("img");

      //  this.globalItems &&
      //   this.globalItems.length > 0 &&
      if (this.showGlobalParameter && this.inputDisplayParamItems.length > 0) {
        img.show();
        $("#" + id).attr("flag", "display");
        $("#" + id).attr("title", "显示更多参数");

        img.attr("src", this.tdRightImg("plus"));
      } else if (
        this.showGlobalParameter &&
        this.inputDisplayParamItems.length < 1
      ) {
        img.hide();
      }
      this.setShowOrHidBtnStyle(0); //默认
    },
    /**
       *设置算法参数（不包括基本参数）显示更多和隐藏按钮
      flag==0 表示无基本参数状态(默认)下 界面初始化
      flag==1 表示在基本参数的情况下 点击基本参数显示更多时的 界面初始化（所有算法参数自动全部展开）
      */
    setShowOrHidBtnStyle(flag) {
      let hiddeItem = this.hiddenImputDtParam;
      let id = "";
      hiddeItem.forEach((element, index) => {
        id = element.groupName + "_" + index;
        id = this.getFormatId(id);
        let img = $("#" + id).find("img");

        if (flag == 1) {
          $("#" + id).attr("flag", "hidden");
          $("#" + id).attr("title", "隐藏参数");
          img.attr("src", this.tdRightImg("reduce"));
        } else {
          if (element.length < 1) {
            $("#" + id).css("display", "none");
          } else {
            $("#" + id).css("display", "block");
            img.attr("src", this.tdRightImg("plus"));
          }
        }
      });
    },
    //解决Dom元素标签id为特殊字符 根据元素id获取Dom对象失败问题
    getFormatId(srcString) {
      // 转义之后的结果
      var result = srcString;
      // javascript正则表达式中的特殊字符
      var jsSpecialChars = [
        "\\",
        "^",
        "$",
        "*",
        "?",
        ".",
        "+",
        "(",
        ")",
        "[",
        "]",
        "|",
        "{",
        "}",
      ];

      // jquery中的特殊字符,不是正则表达式中的特殊字符
      var jquerySpecialChars = [
        "~",
        "`",
        "@",
        "#",
        "%",
        "&",
        "=",
        "'",
        '"',
        ":",
        ";",
        "<",
        ">",
        ",",
        "/",
      ];

      for (var i = 0; i < jsSpecialChars.length; i++) {
        result = result.replace(
          new RegExp("\\" + jsSpecialChars[i], "g"),
          "\\" + jsSpecialChars[i]
        );
      }

      for (var i = 0; i < jquerySpecialChars.length; i++) {
        result = result.replace(
          new RegExp(jquerySpecialChars[i], "g"),
          "\\" + jquerySpecialChars[i]
        );
      }
      return result;
    },
    //基本参数和算法参数：显示更多参数或者隐藏参数
    displayInputDtParamBtn(data, index) {
      let id = "";
      let groupName = "";
      let btnName = "";

      if (data === "globalBtn") {
        //基本参数右侧控制按钮
        btnName = "globalBtn";
        id = "globalParamId";
      } else {
        //算法参数右上角显示控制按钮
        groupName = data.groupName; //当前表格算法分组
        id = groupName + "_" + index; //当前td id
        id = this.getFormatId(id);
      }

      let flag = $("#" + id).attr("flag");
      if (flag == "display") {
        //show more
        this.displayAlgoBtnStyle(data, index, id, btnName);
      } else if (flag == "hidden") {
        //hidden more
        this.hiddenAlgoBtnStyle(data, index, id, btnName);
      }
    },
    displayAlgoBtnStyle(data, index, id, btnName) {
      let img = $("#" + id).find("img");
      $("#" + id).attr("flag", "hidden");
      $("#" + id).attr("title", "隐藏参数");
      img.attr("src", this.tdRightImg("reduce"));

      if (btnName && data === btnName) {
        this.showInputParameter = !this.showInputParameter;
        //基本参数：展开所有算法参数
        if (!this.globalDisplayBtn) {
          this.displayAllParams();
          this.globalDisplayBtn = true;
        }
        //  this.displayAlgoParam(index)//显示单独算法的所有
        this.setShowOrHidBtnStyle(1);
      } else {
        this.displayAlgoParam(index);
      }
    },
    hiddenAlgoBtnStyle(data, index, id, btnName) {
      let img = $("#" + id).find("img");
      $("#" + id).attr("flag", "display");
      $("#" + id).attr("title", "显示更多参数");
      img.attr("src", this.tdRightImg("plus"));

      if (btnName !== "" && data === btnName)
        this.showInputParameter = !this.showInputParameter;
      else {
        this.hiddenAlgoParam(index);
      }
    },
    //显示表格隐藏算法参数
    displayAlgoParam(index) {
      let currentTableParam = this.inputDisplayParamItems[index];
      let hiddenParam = this.hiddenImputDtParam[index];

      let length = currentTableParam.length;
      for (let j = 0; j < hiddenParam.length; j++) {
        let tempHid = hiddenParam[j];
        this.inputDisplayParamItems[index].push(tempHid);
        // this.$nextTick(function() {
        //   this.$set(this.inputDisplayParamItems[index], length + j, tempHid);
        //   let len = length + j + 1;
        //   this.inputDisplayParamItems[index].splice(len);
        // });
      }
    },
    // 隐藏表格显示算法参数
    hiddenAlgoParam(index) {
      /**
       * 思路：1、获取当前表格数据源currentTableParam：根据当前点击的表格索引获取当前表格参数
       * 2、移除表格数据源要隐藏的参数：currentTableParam和全局的隐藏参数hiddenParam进行比对 如果hiddenParam的参数和currentTableParam参数相同则移除currentTableParam对应的参数
       * 3、更新隐藏参数列表：在2的基础上判断当前全局的hiddenParam和已经显示到表格中的隐藏参数值是否发生变化 是 用currentTableParam最新的参数替换隐藏参数中对应参数
       */
      let currentTableParam = this.inputDisplayParamItems[index];
      let hiddenParam = this.hiddenImputDtParam[index];

      for (let i = 0; i < currentTableParam.length; i++) {
        let tempItem = currentTableParam[i];
        hiddenParam.forEach((element, index1) => {
          if (tempItem.name === element.name) {
            currentTableParam.splice(i, 1); //删除索引i的1个元素
            i--; //必须有
            // if (tempItem.default !== element.default) {
            //   // hiddenParam.findIndex(item => item === tempHid),//返回元素索引
            //   hiddenParam[j].splice(j, 1, tempItem); //在索引为indexx1的位置删除一个元素再添加一个元素对象 tempItem
            // }
          }
        });
      }
    },
    //点击全局参数显示更多后显示所有算法的所有参数
    displayAllParams() {
      let _this = this;
      let display = this.inputDisplayParamItems;
      display.forEach((ele, index) => {
        _this.displayAlgoParam(index);
      });
    },
    regionChangeEvent(value, selectedData) {
      // this.region = selectedData.map((ele) => ele.label).join(",");
      if (selectedData.length < 1) return;
      let item = selectedData[selectedData.length - 1];
      this.regionTitle = value.join("/");
      if (item.tag === "china" || item.tag === "other") {
        this.region["name"] = item.label;
        this.region["geometry"] = item.geometry;
        this.region["code"] = item.code;
        // this.region["classify"] = item.classify;
      } else this.searchGeometryByCode(item);
    },
    changeInput(index) {
      this.listproductLine.map((v, i) => {
        if (i == index) {
          v.isCheck = true;
        } else {
          v.isCheck = false;
        }
      });
      let name = this.listproductLine[index].workflowName;
      let currentTime = this.getCurrentTime();
      this.taskName = name + "_" + this.userName + "_" + currentTime;
    },
    changeInputLevel(index) {
      this.options.map((v, i) => {
        if (i == index) {
          v.isCheck = true;
          this.priorityLevel = v.value;
        } else v.isCheck = false;
      });
    },
    changeInputProductionType(index) {
      if (index == 1) {
        //合成
        this.isRegion = true;
        this.timeRow = true;
        this.algoModelRow = true;
        this.searchprovince();

        this.currentTime = this.dateFormat("YYYY-mm", this.currentTime);
      } else {
        this.isRegion = false;
        this.timeRow = false;
        this.algoModelRow = true;
      }
      this.productionType.map((v, i) => {
        if (i == index) {
          v.isCheck = true;
          let value = {};
          let key = "ProducType-产品类型";
          value[key] = [];
          value[key].push(v.value);

          this.productionTypeValue = value;
          // ProducType-产品类型: ["单景产品"]
        } else v.isCheck = false;
      });

      this.filterProcessByConditons();
    },
    changeInputMixType(index) {
      this.mixType.map((v, i) => {
        if (i == index) {
          v.isCheck = true;
          this.mixTypeValue = v.value;
        } else {
          v.isCheck = false;
        }
      });
    },
    changeInputAlgoType(index) {
      this.filterProcessByConditons();
    },
    changeSensorType(index) {
      this.filterProcessByConditons();
    },
    changeInputTimeOption(index) {
      this.timeList.map((v, i) => {
        if (i == index) {
          v.isCheck = true;
          // this.currentTime = v.value;
        } else v.isCheck = false;

        if (index == 0) {
          this.timeType = "month"; //monthrange
          this.timePlaceholder = "请选择月份";
          this.timeFormat = "yyyy-MM";
        }
        //  else if (index == 1) {
        //   this.timeType = "quarter"; //quarterrange
        //   this.timePlaceholder = "请选择季度";
        //   this.timeFormat = "yyyy-MM-dd";
        // }
        else if (index == 1) {
          this.timeType = "year";
          this.timePlaceholder = "请选择年份";
          this.timeFormat = "yyyy";
        }
      });
    },
    changeInputRegionOption(index) {
      // this.regionType.map((v, i) => {
      //   if (i == index) {
      //     v.isCheck = true;
      //     this.currentRegionType = v.value;
      //   } else {
      //     v.isCheck = false;
      //   }
      // });date
    },
    getCurrentTime() {
      var date = new Date();
      var year = date.getFullYear();
      var month = date.getMonth() + 1;
      var day = date.getDate();
      var hours = date.getHours();
      var minutes = date.getMinutes();
      var seconds = date.getSeconds();
      if (month < 10) {
        month = "0" + month;
      }
      if (day < 10) {
        day = "0" + day;
      }
      let time = year + "" + month + "" + day + " " + hours + ":" + minutes;
      return time;
    },
    filterProcessByConditons() {
      let _this = this;
      // let productionType = this.productionTypeValue;
      let resultData = {};
      Object.keys(_this.productionTypeValue).forEach((key) => {
        resultData[key] = _this.productionTypeValue[key];
      });
      /*----------- 修改段 start-----------  */
      //只在单景条件下搜索
      /*  if (JSON.stringify(_this.productionTypeValue).indexOf("单景") != -1) {
                    Object.keys(_this.sensorOptionValue).forEach((key) => {
                      resultData[key] = _this.sensorOptionValue[key];
                    });
                    Object.keys(_this.algoTypeOptionValue).forEach((key) => {
                      resultData[key] = _this.algoTypeOptionValue[key];
                    });
                  }*/
      //单景和多景条件下都能搜索
      Object.keys(_this.sensorOptionValue).forEach((key) => {
        resultData[key] = _this.sensorOptionValue[key];
      });
      Object.keys(_this.algoTypeOptionValue).forEach((key) => {
        resultData[key] = _this.algoTypeOptionValue[key];
      });
      /*----------- 修改段 end-----------  */

      resultData = JSON.stringify(resultData) === "{}" ? "" : resultData;
      if (resultData == "") {
        _this.$Message.info(
          "未查到对应条件的算法数据，默认显示该流程下所有算法流程哦!"
        );
      }

      this.filterLabels = resultData;
      this.getCommonProduct();
    },
    getCommonProduct() {
      let _this = this;
      let path = _this.$api.processingApi.systemQuery; //search query
      let labels = _this.filterLabels;
      if (labels == "") {
        labels = null;
      } else {
        labels = encodeURIComponent(JSON.stringify(_this.filterLabels));
      }

      let param = {
        groupId: _this.id,
        labels: "", //labels, //标签编号
      };

      _this.http.get(path, param).then((res) => {
        let data = res.data;
        if (data.code == 0) {
          if (data.data.length > 0) {
            _this.showCreateTaskModal = true;
            //1、获取所有流程线
            let tempList = [];
            for (var item in data.data) {
              let tempItem = data.data[item];
              if (item == 0) {
                tempItem["isCheck"] = true;
              } else {
                tempItem["isCheck"] = false;
              }
              tempList.push(tempItem);
            }
            _this.listproductLine = tempList;

            if (
              _this.type === _this.typeOption[1] &&
              tempList.length <= 1 &&
              _this.taskType === 2
            ) {
              _this.productionLineRow = false;
            } else {
              _this.productionLineRow = true;
            }
            _this.workflowId = data.data[0].id;
            _this.taskdesc = tempList[0].description;
            // 2、流程图
            _this.displayProductionLineGraph();
            // 3、根据workflowId动态获取算法参数;
            _this.getProcessParamsByWorkflowId();
            //4、任务名称
            _this.taskName =
              data.data[0].workflowName +
              "_" +
              _this.userName +
              "_" +
              _this.getCurrentTime();
          } else {
            // _this.showCreateTaskModal = false;
            _this.items = [];
            _this.listproductLine = [];
            _this.displayProductionLineGraph();
            _this.inputDisplayParamItems = [];
            _this.globalItems = [];

            if (confirm("未查到，是否显示全部")) {
              _this.filterLabels = "";
              _this.getCommonProduct();
            } else {
              _this.showGlobalParameter = false;
            }
          }
        } else {
          this.$Message.error(res.data.message);
        }
         this.filterPreferenceData();
      });
    },
    // 时间输入框判断 start
    onTimeChange(time, type) {
      let _this = this;
      type = _this.timeType;
      if (type === "quarter") {
        _this.currentTime = time[0] + "-" + time[1];
      } else {
        _this.currentTime = time;
      }
    },
    /************************ 以下为目录浏览功能 ************************/
    //文件浏览功能
    browserFile(item) {
      let that = this;
      this.currentItem = item;
      this.fileCatalogModal = true;
      this.$nextTick(() => {
        that.$refs.refFileCatalogModal.initFileTree(item, that.isBatch);
      });
    },
    browserRef(item) {
      let that = this;
      this.spatialRefManageModal = true;
      this.currentItem = item;
      this.$nextTick(() => {
        that.$refs.refSpatialRefManageModal.initRefTree(item);
      });
    },
    fileCatalogModalOk(data) {
      this.currentItem.default = data;
      this.fileCatalogModal = false;

      // this.currentItem.constraint.defaultType = "path";
      // this.currentItem.tempDefault = data;

      // this.setQuery(data, this.currentItem);
      // this.isQueryChange(data, this.currentItem);
    },
    fileCatalogModalClose() {
      this.fileCatalogModal = false;
    },
    spatialRefManageModalOk() {
      this.spatialRefManageModal = false;
      this.currentItem.default = data;
    },
    spatialRefManageModalClose() {
      this.spatialRefManageModal = false;
    },

    /************************以上文件浏览功能 ************************/

    /************************以下 行政区域 相关功能 后续会删掉 功能已经单独封装为组件 ************************/

    searchprovince() {
      let self = this;
      let path = this.$api.processingApi.queryFeatureBase64;
      let param = {
        collectionName: "area_info",
        orderColName: "code",
        outputEpsg: 4326,
        queryConditionList: [
          {
            compareOp: "=",
            fieldName: "type",
            fieldValue: 0,
          },
        ],
        queryResultList: ["name", "code"],
        // queryResultList: [],
      };
      let strJson = JSON.stringify(param);
      let sendData =  this.$Base64.encode(strJson);
      self.http.postText(path, sendData).then((res) => {
        if (res.data.code == 0) {
          let province = res.data.data.data;
          for (let i = 0; i < province.length; i++) {
            let tempdata = {
              code: province[i].properties.code,
              label: province[i].properties.name,
              value: province[i].properties.name, //可以不写 但是字体会变颜色
              children: [],
              loading: false,
              tag: "province",
            };
            self.regionCascader.push(tempdata);
          }
        }
      });
    },
    searchCity(item, callback, tag) {
      let _this = this;
      let path = this.$api.processingApi.queryFeatureBase64;
      let typeValue;
      if (tag === "city") {
        typeValue = 1;
      } else if (tag === "region") {
        typeValue = 2;
      } else if (tag === "china") {
        typeValue = -1;
      } else {
        return;
      }
      let param = {
        collectionName: "area_info",
        orderColName: "code",
        outputEpsg: 4326,
        queryConditionList: [
          {
            compareOp: "=",
            fieldName: "type",
            fieldValue: typeValue,
            relationNextOne: "AND",
          },
          {
            compareOp: "=",
            fieldName: "parent_code",
            fieldValue: item.code,
          },
        ],
        queryResultList: ["name", "code"],
      };
      let strJson = JSON.stringify(param);
      let sendData =  this.$Base64.encode(strJson);
      _this.http.postText(path, sendData).then((res) => {
        let data = res.data.data.data;
        for (let j = 0; j < data.length; j++) {
          let tempdata = {
            value: data[j].properties.name,
            code: data[j].properties.code,
            label: data[j].properties.name,
            children: [],
            loading: false,
            tag: tag,
          };
          if (tag === "region" || tag === "china") {
            delete tempdata.children;
            delete tempdata.loading;
          }
          item.children.push(tempdata);
        }
        item.loading = false;
        callback();
      });
    },
    searchGeometryByCode(item) {
      let _this = this;
      let path = this.$api.processingApi.queryFeatureBase64;
      let type = 0;
      if (item.tag === "city") type = 1;
      else if (item.tag === "region") type = 2;
      let param = {
        collectionName: "area_info",
        outputEpsg: 4326,
        orderColName: "code",
        queryConditionList: [
          {
            compareOp: "=",
            fieldName: "type",
            fieldValue: type,
            relationNextOne: "AND",
          },
          {
            compareOp: "=",
            fieldName: "code",
            fieldValue: item.code,
          },
        ],
        queryResultList: [],
      };
      let strJson = JSON.stringify(param);
      let sendData =  this.$Base64.encode(strJson);
      _this.http.postText(path, sendData).then((res) => {
        let data = res.data.data.data;
        if (res.data.code == 0) {
          _this.region["name"] = item.label;
          _this.region["geometry"] = data[0].geometry;
          _this.region["code"] = item.code;
          // _this.region["classify"] = item.classify;
        } else {
          _this.$Message.error(res.data.message);
        }
      });
    },
    loadRegionData(item, callback) {
      let _this = this;
      item.loading = true;
      setTimeout(() => {
        if (item.tag === "other") {
          item.children = [
            {
              value: "重点区域",
              label: "某重点区域",
              tag: "other",
              code: 1,
              classify: "other",
            },
          ];
        } else if (item.tag === "china") {
          _this.searchCity(item, callback, "china");
        } else if (item.tag === "province") {
          _this.searchCity(item, callback, "city");
        } else if (item.tag === "city") {
          _this.searchCity(item, callback, "region");
        }
        item.loading = false;
        callback();
      }, 500);
    },
    /************************以上 行政区域 相关功能 ************************/

    MyFileClicked() {
      let name = window.sessionStorage.getItem("user");
      let userId = window.sessionStorage.getItem("userId");
      this.url = fileUrl + "/?name=" + name + "&userId=" + userId;
      this.myFileModal = true;
    },
    myFileOk() {
      this.userMenu(this.currentItem);
      this.myFileModal = false;
    },
    myFileCancel() {
      this.myFileModal = false;
    },
  },
};
</script>

<!--css样式-->
<style lang="scss" scoped>
/deep/.ivu-message {
  z-index: 999999999999999 !important;
}

.picDiv {
  width: 310px;
  background: rgba(255, 255, 255, 1);
  border-radius: 4px;
  border: 1px solid rgba(217, 217, 217, 1);
  margin: 0.1rem 1rem 0 5rem;
  height: 494px;
  // display: flex;
  // justify-content: center;
  // align-items: center;

  .img1 {
    max-width: 100%;
    max-height: 460px;
  }
}

.inputStyle {
  display: flex;
  align-items: center;
  justify-content: center;
}
.optiostyle {
  position: absolute;
  right: 0;
  z-index: 99;

  display: flex;
  height: 40px;
  width: 280px;
  align-items: center;
  margin-top: -50px;

  font-size: 1rem;
  font-weight: bold;
}

.myFileDiv {
  margin-top: -22px;
  margin-left: 96px;
}

.myFileBtn {
  width: 70px;
  height: 21px;
  font-size: 13px;
  margin: 0px;
  padding: 0px;
}

.saveFileStyle {
  width: 280px;
}

.treeDiv {
  height: 500px;
  width: 760px;
  overflow-y: auto;
}

.treeDiv1 {
  height: 300px;
  width: 300px;
  overflow-y: auto;
}

.suffixBtn {
  margin-left: 10px;
}

.selectSuffix {
  padding-left: 10px;
  margin-bottom: 0rem;
}

.inputTd {
  float: left;
  width: 88%;
  margin: 3px 0;
  margin-left: 5px;
}

.inputTdTextArea {
  float: left;
  width: 88%;
  margin-bottom: 7px;
}

.btnBrowser {
  float: right;
  margin-top: 8px;
  margin-bottom: 0px;
}

.paramBtn {
  border: 0;
  color: #95a5bc;
}

.batchSelect {
  width: 550px;
  height: 200px;
  overflow: auto;
}

.inputRadioDiv {
  display: flex;
  flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  width: 527px;
  margin-left: 34px;
  background: rgba(216, 216, 216, 0.09);
  border-radius: 3px;
  border: 1px solid rgba(151, 151, 151, 0.09);
  max-height: 270px;
  overflow-y: auto;
  margin-left: 34px;
}

.inputRadioDiv1 {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  width: 150px;
  height: calc(1.5rem + 0.75rem + 2px);
  margin-left: 40.6%; // 103px;
  background: rgba(216, 216, 216, 0.09);
  border-radius: 3px;
  border: 1px solid rgba(151, 151, 151, 0.09);
  padding-top: 6px;
}

.filterRadioRow {
  margin-top: -11px;
  margin-bottom: 3px;
}

.inputRadioDiv2 {
  display: flex;
  width: 276px;
  height: calc(1.5rem + 0.75rem + 2px);
  margin-left: 38px;
}

.inputRadioDiv3 {
  display: flex;
  align-items: center;
  height: calc(1.5rem + 0.75rem + 2px);
  margin-left: 16px;
}

.inputRadioDiv4 {
  display: flex;
  height: calc(1.5rem + 0.75rem + 2px);
  margin-left: 38px;
}

.processFileterDiv {
  width: 390px;
  text-align: left;
}

.levelDiv {
  width: 42px;
  float: left;
  padding-top: 6px;
  margin-left: 38px;
}

.levelDiv1 {
  width: 60px;
  float: left;
  padding-top: 6px;
  margin-left: 38px;
}

.inputRadio {
  width: 48%;
  margin-left: 10px;
}

.btn1 {
  margin: 0.3rem;
}

.footDiv {
  z-index: 99;
  width: 100%;
  margin-top: -38px;
}

.jia {
  width: 12px;
  height: 12px;
  margin: -15px 0 3px -6px;
}

.imgBtn {
  position: absolute;
  right: 11px;

  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.tbHeader {
  width: 100%;
  display: inline-block;
}

.styImg {
  vertical-align: middle;
  max-width: 700px;
  overflow: auto;
}

// .processFilter {
//   cursor: pointer;
// }

// .processFilter:hover {
//   color: #2d8cf0;
// }

.datePick {
  width: 212px;
  float: right;
  margin-left: 34px;
  margin-top: 2px;
}

.regionCas {
  width: 212px;
  float: right;
  margin-left: 88px; //34px;
  margin-top: 2px;
}

.filterLabel {
  margin-top: 9px;
}

.iframe {
  width: 100%;
  height: 67vh;
  border: 1px saddlebrown;
}

/**leftCard 整体布局 start */
.cardBody {
  margin: 0 10px 10px 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

header {
  flex: 0 0 auto;
}

main {
  overflow: hidden;
  overflow-y: auto;
  flex-grow: 1;

  margin-bottom: 16px;
}

/**leftCard 整体布局 end */
</style>

<style scoped>
/*表单错误提示*/
.processingModal
  .paramTable
  .ivu-form-item-error-tip
  /deep/
  .ivu-form-item-error-tip {
  right: 3px !important;
  top: 11px !important;
  width: 147px !important;
  margin-left: 5px;
}

/deep/ .form-control {
  padding: 0 10px !important;
}

/*.processingModal .paramTable   .inputSelectTd /deep/ .form-control {
        padding-left: 0;
        padding-right: 13px;
      }*/
</style>
